package com.xc.freeapp.jwt;

import org.springframework.stereotype.Component;

import com.xc.freeapp.util.JwtUtil;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;

/**
 * Created by shaowen on 2015/7/13.
 */
@Component
public class WebAppSigner {

    public boolean checkAuth(HttpServletRequest request,HttpServletResponse response) {
        checkSign(request,response);
        return true;
    }

    private void checkSign(HttpServletRequest httpServletRequest,HttpServletResponse response) {
        String token = httpServletRequest.getParameter("token");
        response.setHeader("Access-Control-Allow-Origin", "*");
        JwtUtil.vifity(token);
    }
}
